<template>
  <div>
    <nav-bar title="任务详情"></nav-bar>
    <div class="taskDetails maxinBox" v-if="data">
      <van-cell title="危险等级" v-if="data.riskLevel === 1" value="I级" />
      <van-cell title="危险等级" v-else-if="data.riskLevel === 2" value="II级`" />
      <van-cell title="危险等级" v-else value="III级" />
      <van-cell title="发起人" :value="data.createBy" />
      <van-cell title="发起时间" :value="data.createTime | formatDate('YYYY-MM-DD HH:mm')" />
      <van-cell class="marginTop5" title="整改人" v-if="data.trouble && data.trouble.handlers.length" :value="data.trouble.handlers | personal" />
      <van-cell title="抄送人" v-if="data.trouble && data.trouble.notifiers.length" :value="data.trouble.notifiers | personal" />
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        data: null
      }
    },
    filters: {
      personal(val) {
        return val.map(item => {
          return `${item.userName} (${item.userMobile})`
        }).join(',') || '--'
      }
    },
    mounted() {
      this.data = JSON.parse(JSON.stringify(this.$route.params.data))
    }
  }
</script>
